package com.huawei.appmarket.service.appdetail.view.card;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import com.huawei.appmarket.service.exposure.bean.ExposureDetail;
import com.huawei.appmarket.service.store.awk.bean.BaseHorizontalCardBean;
import com.huawei.appmarket.service.store.awk.widget.horizon.BaseHorizonCard;
import java.util.ArrayList;
import java.util.List;
import o.cdr;
import o.chy;
import o.chz;
import o.cih;
import o.cii;
import o.cil;
import o.cim.a;
import o.cjk;
import o.cjm;
import o.cjo;
import o.dgm;
import o.Logger;
import o.doo;
import o.drl;
import o.drr.b;
import o.dyg;
import o.dyk;
import o.ead;
import o.ebt;
import o.evk;
import o.ewm.n;

public abstract class BaseDetailHoriCard extends drl implements chy {
    private int ʻ;
    private BaseHorizontalCardBean ʼ;
    protected BaseHorizonCard ʽ;
    protected cdr ॱॱ;

    public abstract cdr ˋ(Context context);

    public View ˊ(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        this.ॱॱ = ˋ(viewGroup.getContext());
        if (this.ॱॱ == null) {
            return null;
        }
        View ˊ = this.ॱॱ.ˊ(layoutInflater, null);
        if (this.ॱॱ.ˊ(ˊ, viewGroup)) {
            this.ॱॱ.ˋ(this);
        }
        if (this.ॱॱ.ˎ(0) instanceof BaseHorizonCard) {
            this.ʽ = (BaseHorizonCard) this.ॱॱ.ˎ(0);
        }
        this.ˊ = ˊ;
        this.ʻ = dgm.ˎ((Activity) this.ˊ.getContext());
        return ˊ;
    }

    public boolean ˊ(List<JsonBean> list) {
        return false;
    }

    public boolean ˊ(b bVar) {
        List ʼ = bVar.ʼ();
        if (ʼ == null || ʼ.size() <= 0) {
            return false;
        }
        if (!(ʼ.get(0) instanceof BaseHorizontalCardBean)) {
            return false;
        }
        this.ʼ = (BaseHorizontalCardBean) ʼ.get(0);
        if (this.ॱॱ.ˎ(0) != null && (this.ॱॱ.ˎ(0) instanceof BaseHorizonCard)) {
            BaseHorizonCard baseHorizonCard = (BaseHorizonCard) this.ॱॱ.ˎ(0);
            if (baseHorizonCard != null) {
                this.ʼ.ˋˋ(this.ᐝ);
                chz o_chz = new chz(Long.parseLong(bVar.ᐝ()), this.ॱॱ, 0);
                o_chz.ˋ(bVar.ˎ(), bVar.ˏ());
                o_chz.ˏ(bVar.ॱ());
                o_chz.ॱ(bVar.ˋ());
                o_chz.ˋ(bVar.ॱ());
                baseHorizonCard.ˊ(o_chz, bVar.ʽ());
                baseHorizonCard.ˏ(this.ʼ);
            }
        }
        return true;
    }

    public void ˏ(int i, cih o_cih) {
        CardBean ˌ = o_cih.ˌ();
        Context ॱˋ = ˋ() == null ? null : ˋ().ॱˋ();
        if (ˌ instanceof BaseDistCardBean) {
            BaseDistCardBean baseDistCardBean = (BaseDistCardBean) ˌ;
            if (baseDistCardBean.ͺ() == 12) {
                if (ॱˋ != null) {
                    ˋ(ॱˋ, baseDistCardBean);
                } else {
                    Logger.ˎ("BaseDetailHoriCard", "can not show noApk warning dialog");
                }
                cil.ˋ(ॱˋ, new a(baseDistCardBean).ˋ());
                return;
            }
        }
        if (!ˊ(ॱˋ, i, ˌ)) {
            if (i == 0 || 9 == i) {
                BaseDistCardBean baseDistCardBean2 = (BaseDistCardBean) ˌ;
                if (ॱˋ != null && baseDistCardBean2 != null) {
                    if (baseDistCardBean2.ॱॱ() != null || baseDistCardBean2.ˑ() != null) {
                        if (!(baseDistCardBean2.ॱॱ() == null || cii.ˊ().ˊ(ॱˋ, baseDistCardBean2, i))) {
                            cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
                            appDetailActivityProtocol.ˏ(new Request(baseDistCardBean2.ॱॱ(), baseDistCardBean2.u_()));
                            cjk.ˎ().ˋ(ॱˋ, new cjm("appdetail.activity", appDetailActivityProtocol));
                        }
                        ˏ(baseDistCardBean2);
                    }
                }
            }
        }
    }

    private void ˋ(Context context, BaseDistCardBean baseDistCardBean) {
        if ((baseDistCardBean.ˌ() & 2) != 0) {
            Logger.ˎ("BaseDetailHoriCard", "can not launch no apk app, because button status is disabled");
        } else {
            new ebt(context, baseDistCardBean).ˊ();
        }
    }

    private boolean ˊ(Context context, int i, CardBean cardBean) {
        if (i != 0 || !(cardBean instanceof BaseCardBean)) {
            return false;
        }
        BaseCardBean baseCardBean = (BaseCardBean) cardBean;
        if (!baseCardBean.ॱʾ()) {
            return false;
        }
        if (context == null) {
            Logger.ˎ("BaseDetailHoriCard", "context is null, can not show mini detail dialog");
        } else if (doo.ˊ(context)) {
            new ead(context, baseCardBean).ॱ(context);
        } else {
            Logger.ˎ("BaseDetailHoriCard", "no network to show app detail.");
            evk.ˏ(context, n.ʹˊ, 0).ˋ();
        }
        cil.ˋ(context, new a(baseCardBean).ˋ());
        new dyk(this.ʻ).ॱ(baseCardBean);
        return true;
    }

    public List<CardBean> ˎ(String str, String str2) {
        return null;
    }

    private void ˏ(BaseCardBean baseCardBean) {
        dyg ॱ = dyg.ॱ();
        ExposureDetail exposureDetail = new ExposureDetail();
        exposureDetail.ˏ(System.currentTimeMillis());
        exposureDetail.ॱ(baseCardBean.ॱˉ());
        ArrayList arrayList = new ArrayList();
        arrayList.add(baseCardBean.ॱॱ() + "#$#" + baseCardBean.u_());
        exposureDetail.ˎ(arrayList);
        ॱ.ˎ(exposureDetail, this.ʻ);
    }
}
